package trip;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.GenerationType;

@Entity
@Table(name = "COMPANY")
public class Company {
	@Id
    @Column(name = "id")
    @GeneratedValue(strategy = GenerationType.IDENTITY)
	private long id;

	@Column(name = "company_name", nullable = false, length = 30)
	private String name;

	
	//constructors
	public Company() {};
	
	public Company(long id, String name) {
		this.id = id;
		this.name = name;
	}
	
	//id
	public long getId() {
		return id;
	}

	public Company setId(long id) {
		this.id = id;
		return this;
	}

	//name
	public String getName() {
		return name;
	}

	public Company setName(String name) {
		this.name = name;
		return this;
	}
	
	public boolean equals(Company company) {
		if (company == null)
			return false;
		if (this.id == company.id && 
			this.name.equalsIgnoreCase(company.name))
			return true;
		else
			return false;
	}
}